package com.crm.system.controller.contractManager.statistics;

/**
 * @author yincuimei
 * @Date 2021/4/22 15:02
 * 新会员分析
 */
import com.crm.common.model.DataResponse;
import com.crm.common.model.DhResponse;
import com.crm.common.model.Enum.ResponseCodeEnum;
import com.crm.model.entity.reportStatistics.EchartModel;
import com.crm.system.service.contractManager.statistics.CustomerContractStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/statistics")
public class CustomerContractStatisticsController {
    @Autowired
    private CustomerContractStatisticsService  customerContractStatisticsService;

    /**
     * 新会员招募率
     * @return
     */
    @PostMapping("/selectNewMembersAndDealCountByYear")
    public DhResponse newMembersRecruitmentRate(@RequestParam(value = "dateUnit", required = true) Integer dateUnit){
        EchartModel echartModel = customerContractStatisticsService.selectNewMembersAndDealCountByYear(dateUnit);
        return new DhResponse(ResponseCodeEnum.OK.getResponseCode(),echartModel);
    }
}
